<template>
  <el-container>
    <el-main class="main-bg">
      <div class="main">
        <el-descriptions :title="form.lpUnitName">
          <el-descriptions-item label="单位地址：">{{
            form.districtName
          }}</el-descriptions-item>
          <el-descriptions-item label="企业类型：">{{
            form.unitTypeName
          }}</el-descriptions-item>
          <el-descriptions-item label="单位联系人：">{{
            form.chargePerson
          }}</el-descriptions-item>
          <el-descriptions-item label="联系电话："
            >{{ form.linkTelephone }}
            <!-- <el-tag size="small">学校</el-tag> -->
          </el-descriptions-item>
          <el-descriptions-item label="防雷等级：">{{
            form.districtName
          }}</el-descriptions-item>
          <el-descriptions-item label="检查报告有效期："
            >-</el-descriptions-item
          >
          <el-descriptions-item label="检查时间：">{{
            form.createdTime
          }}</el-descriptions-item>
          <el-descriptions-item label="检查结果：">-</el-descriptions-item>
          <el-descriptions-item label="执法人员：">{{
            form.rawPersonName
          }}</el-descriptions-item>
        </el-descriptions>
        <!-- <historyTable></historyTable> -->
        <iframe
          :src="sign_url"
          class="iframe"
          width="100%"
          frameborder="0"
          allowfullscreen="true"
        />
        <div class="btn">
          <el-button @click="$router.push('/historyList')">返回</el-button>
        </div>
      </div>
    </el-main>
  </el-container>
</template>

<script>
import { findByPlanDetailId } from "@/api";
import { searchMedia } from "./api";
import eventType from "@/mixins/eventType";
// import historyTable from "./history-table.vue"
export default {
  name: "historyDetail",
  mixins: [eventType],
  components: {
    // historyTable
  },
  data() {
    return {
      sign_url: "",
      form: {},
    };
  },
  created() {
    const { detailId } = this.$route.query;
    this.getInitData(detailId);
  },
  methods: {
    getInitData(detailId) {
      findByPlanDetailId({ detailId: detailId })
        .then(({ data }) => {
          const metLpInspect = data.metLpInspect ? data.metLpInspect : {};
          this.sign_url = metLpInspect.signUrl || "";
          this.form = data;
          const arr = this.plugins_met_unit_type.filter((item) => {
            return data.unitType == item.codeValue;
          });
          this.form.unitTypeName = arr[0].codeName;
          this.form.createdTime = metLpInspect.createdTime;
        })
        .catch((err) => {
          console.log(
            "🚀 ~ file: sign.vue ~ line 305 ~ getInitData ~ err",
            err
          );
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.main {
  width: 100%;
  display: flex;
  justify-content: center;
  background: #fff;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  .iframe {
    height: calc(100vh - 110px);
  }
  .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
  }
}
</style>
